package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-03-05 23:34
 */
public class DeleteNode {

    public ListNode deleteNode(ListNode head, int val) {

        ListNode dummy = new ListNode(-1),p=dummy;
        dummy.next=head;
        while (p.next != null) {
            if (p.next.val == val) {
                p.next = p.next.next;
                break;
            }
            p = p.next;
        }
        return dummy.next;
    }


}
